/**
 * 员工端（生产端、物流端）api
 * 很多接口是参考若依管理系统前后端分离版
 */

import http from '@/common/http'

const api = {}

/**
 * @typedef {Object} CaptchaResponse
 * @property {number} code - 返回的状态码
 * @property {string} msg - 返回的消息
 * @property {boolean} captchaEnabled - 表示验证码是否启用
 * @property {string} img - 验证码图片的URL
 * @property {string} uuid - 返回的UUID
 */
/**
 * 获取登录图形验证码
 * @returns {CaptchaResponse}
 */
api.getCaptchaImage = (data, config = {}) => http.get('captchaImage', data, config)
api.getTime = (dictType, data, config = {}) => http.get('/system/config/configKey/' + dictType, data, config)
/**
 * @typedef {Object} LoginResponse
 * @property {number} code - 返回的状态码
 * @property {string} msg - 返回的消息
 * @property {string} token - 用户token
 */
/**
 * 员工登录
 * @param {object} data
 * @param {string} data.username  登录用户名称
 * @param {string} data.password  登录密码
 * @param {string} data.code      验证码（验证码启用时必传）
 * @param {string} data.uuid      验证码UUID（验证码启用时必传）
 * @returns {LoginResponse}
 */
api.postLogin = (data, config = {}) => http.post('/login', data, config)
/** 获取员工信息 */
api.getStaffInfo = (data, config = {}) => http.get('/getInfo', data, config)
/** 退出登录 */
api.postLogout = (data, config = {}) => http.post('/logout', data, config)
/** 查询当前用户所在的分组 */
api.postStaffGroup = (data, config = {}) => http.post('/user/group/query/group/name', data, config)
/**
 * 获取某字典类型下的所有数据
 * @param {String} dictType 字典类型 self_production_process=生产工序
 * @param {Object} data
 * @param {Object} config
 * @returns
 */
api.getDictTypeData = (dictType, data, config = {}) => http.get('/system/dict/data/type/' + dictType, data, config)
/**
 * 员工登录
 * @param {object} data
 * @param {string} data.oldPassword 旧密码
 * @param {string} data.newPassword 新密码
 */
api.putUpdatePwd = (data, config = {}) => http.put(`/system/user/profile/updatePwd?oldPassword=${data.oldPassword}&newPassword=${data.newPassword}`, data, config)


api.getOrderList = (data, config = {}) => http.post('/orders/list', data, config)

api.getBatchList = (data, config = {}) => http.post('/batch/mini/list', data, config)

api.getBatchInfo = (data, config = {}) => http.post('/batch/mini/info', data, config)

api.getScan = (data, config = {}) => http.post('/batch/mini/scan/code', data, config)


api.makeOrder = (data, config = {}) => http.post('/orders/make', data, config)


api.getOrderData = (data, config = {}) => http.post('/orders/info', data, config)


api.getDeliveryList = (data, config = {}) => http.post('/delivery/list', data, config)

api.deliveryOrder = (data, config = {}) => http.post('/orders/delivery', data, config)
//收货
api.deliveryOrderFinish = (data, config = {}) => http.post('/orders/delivery/finish', data, config)

//订单完成
api.orderFinish = (data, config = {}) => http.post('/orders/finish', data, config)



//物流
api.queryTrack = (data, config = {}) => http.post('/orders/query/track', data, config)

export default api
